﻿<navigation:Page 
  x:Class="DemoDataGridToolBar.Views.RIA_indir_edit" 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

  xmlns:riac="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices"
  xmlns:domain="clr-namespace:AdventureWorksService.Web;assembly=AdventureWorksService"
  xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"						 
  xmlns:mac="clr-namespace:System.Windows.Controls;assembly=Slma.Windows.Controls.RIA"
  xmlns:ma="clr-namespace:System.Windows.Controls;assembly=Slma.Windows.Controls"
								 
  mc:Ignorable="d"
  xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
  d:DesignWidth="800" d:DesignHeight="480"
  Title="RIA_indir_edit Page">
  <Grid x:Name="LayoutRoot">
    <!-- DomainDataSource -->
    <riac:DomainDataSource x:Name="dsProducts" AutoLoad="True" QueryName="GetVwProduct" LoadSize="30" >
      <riac:DomainDataSource.DomainContext>
        <domain:AdventureWorksDomainContext />
      </riac:DomainDataSource.DomainContext>
      <!-- !!!!!! Set a SortDescriptor. It is necessary for a tru run DataPager --> 
      <riac:DomainDataSource.SortDescriptors>
        <riac:SortDescriptor PropertyPath="Name" Direction="Ascending" />
      </riac:DomainDataSource.SortDescriptors>
    </riac:DomainDataSource>

    <StackPanel Orientation="Vertical" Margin="0,20,0,0" Width="350">
      <!--*************************************************************************************************-->
      <!-- 
      DataGridGindig
      You have to set a Binding to a DataGrid and a DomainDataSource
      ********************************** -->
      <mac:DataGridToolBarRIA  
        Height="45" Margin="0,0,0,2" 
        ButtonAddNewVisible="True" ButtonEditVisible="True"                       
				DataGrid="{ Binding ElementName=dgProducts, Mode=OneTime}"	
				DomainDataSource="{ Binding ElementName=dsProducts, Mode=OneTime}"
				CreateDataForm="DataGridToolBarRIA_CreateDataForm"										
				>
        <!--   Here you can either set the columns you can use for filtering  
        or set property AutoGenerateFilter="True" in the DataGridToolBarRIA to setup all columns for filtering.
        -->
        <mac:DataGridToolBarRIA.ColumnsForFiltering>
          <ma:DataGridToolBarFilterItem ColumnName="Name"  />
          <ma:DataGridToolBarFilterItem ColumnName="Color"  />
          <ma:DataGridToolBarFilterItem ColumnName="Size"  />
        </mac:DataGridToolBarRIA.ColumnsForFiltering>
        <!--Here you can put own controls inside the DataGridToolBar control. 
        For example: DataPager
        -->
        <mac:DataGridToolBarRIA.Content>
          <data:DataPager x:Name="dpTest" PageSize="10" Source="{Binding ElementName=dsProducts, Path=Data}" BorderThickness="0" Background="Transparent" ></data:DataPager>
        </mac:DataGridToolBarRIA.Content>
      </mac:DataGridToolBarRIA>
      <!--*************************************************************************************************-->

      <ma:maDataGrid x:Name="dgProducts" Height="300" AutoGenerateColumns="False" 	  
				IsReadOnly="True"							
				ItemsSource="{Binding ElementName=dsProducts, Path=Data}"
				>
        <data:DataGrid.Columns>
          <data:DataGridTextColumn Header="{StaticResource ls_product_name}" Width="170" MaxWidth="300" MinWidth="40" 
						Binding="{Binding Name}" >
          </data:DataGridTextColumn>
          <data:DataGridTextColumn Header="{StaticResource ls_product_color}"	Width="70" MaxWidth="300" MinWidth="30" 
						Binding="{Binding Color }" />
          <data:DataGridTextColumn Header="{StaticResource ls_product_size}"  Width="60" MaxWidth="300" MinWidth="30" 
						Binding="{Binding Size}"  ElementStyle="{StaticResource ElementStyle_right}" />
        </data:DataGrid.Columns>
      </ma:maDataGrid>
    </StackPanel>
  </Grid>
</navigation:Page>
